| Package | hl7.fhir.uv.tools | 
| Resource Type | StructureDefinition | 
| Id | CDSHooksRequest | 
| FHIR Version | R5 | 
| Source | http://hl7.org/fhir/tools/https://build.fhir.org/ig/FHIR/fhir-tools-ig/StructureDefinition-CDSHooksRequest.html | 
| URL | http://hl7.org/fhir/tools/StructureDefinition/CDSHooksRequest | 
| Version | 0.8.0 | 
| Status | draft | 
| Date | 2025-08-05T20:48:40+00:00 | 
| Name | CDSHooksRequest | 
| Title | CDSHooks Request (Logical Definition) | 
| Realm | uv | 
| Authority | hl7 | 
| Description | This structure is defined to allow the FHIR Validator to validate a CDSHooks Request Body. TODO: This content will be moved to the CDS Hooks specification in the future | 
| Type | http://hl7.org/fhir/tools/StructureDefinition/CDSHooksRequest | 
| Kind | logical | 
| StructureDefinition | |
| CRDHooksRequest | CRD CDSHooks Request (Logical Definition) | 
| StructureDefinition | |
| CDSHookContext | CDS Hook Specific Context (Logical Definition) | 
| CDSHooksElement | CDSHooks Services Base Extensible Element | 
Note: links and images are rebased to the (stated) source
English
Generated Narrative: StructureDefinition CDSHooksRequest
| Name | Flags | Card. | Type | Description & Constraints | 
|---|---|---|---|---|
|   CDSHooksRequest | C | 0..* | CDSHooksElement | Elements defined in Ancestors:extension A request for decision support Constraints: cds-r-1 | 
|    hook | 1..1 | code | The hook that triggered this CDS Service call | |
|    hookInstance | 1..1 | uuid | A UUID for this particular hook call When this element is read urn:uuid:is prefixed to the value before validation | |
|    fhirServer | 0..1 | url | The base URL of the CDS Client's FHIR server | |
|    fhirAuthorization | C | 0..1 | CDSHooksElement | Authorization info for service to use when querying Constraints: cds-r-2 | 
|     accessToken | 1..1 | string | OAuth 2.0 access token giving access to FHIR server JSON Property Name: access_token | |
|     tokenType | 1..1 | code | Bearer JSON Property Name: token_type Fixed Value: Bearer | |
|     expiresIn | 1..1 | integer | The lifetime in seconds of the access token JSON Property Name: expires_in | |
|     scope | 1..1 | string | Scopes granted by access token | |
|     subject | 1..1 | string | OAuth 2.0 client identifier of the CDS Service | |
|     patient | 0..1 | id | OAuth 2.0 client identifier of the CDS Service | |
|    context | 1..1 | CDSHookContext | Contextual data always needed for this hook type JSON: If %resource.hook = 'appointment-book'then the type is CDSHookAppointmentBookContextJSON: If %resource.hook = 'encounter-start'then the type is CDSHookEncounterStartContextJSON: If %resource.hook = 'encounter-discharge'then the type is CDSHookEncounterDischargeContextJSON: If %resource.hook = 'patient-view'then the type is CDSHookPatientViewContextJSON: If %resource.hook = 'order-dispatch'then the type is CDSHookOrderDispatchContextJSON: If %resource.hook = 'order-sign'then the type is CDSHookOrderSignContextJSON: If %resource.hook = 'order-select'then the type is CDSHookOrderSelectContext | |
|    prefetch | 0..* | Base | Additional information requested by service for this hook type JSON: Represented as a single JSON Object with named properties using the value of the key child as the key | |
|     key | 1..1 | code | Key of FHIR query | |
|     value | 1..1 | Resource | Results of query/read Id may or not be present (this is the default for elements but not resources) JSON: This object can be represented as null in the JSON structure (which counts as 'present' for cardinality purposes) | |
Spanish
Generated Narrative: StructureDefinition CDSHooksRequest
| Name | Flags | Card. | Type | Description & Constraints | 
|---|---|---|---|---|
|   CDSHooksRequest | C | 0..* | CDSHooksElement | Elements defined in Ancestors:extension A request for decision support Constraints: cds-r-1 | 
|    hook | 1..1 | code | The hook that triggered this CDS Service call | |
|    hookInstance | 1..1 | uuid | A UUID for this particular hook call When this element is read urn:uuid:is prefixed to the value before validation | |
|    fhirServer | 0..1 | url | The base URL of the CDS Client's FHIR server | |
|    fhirAuthorization | C | 0..1 | CDSHooksElement | Authorization info for service to use when querying Constraints: cds-r-2 | 
|     accessToken | 1..1 | string | OAuth 2.0 access token giving access to FHIR server JSON Property Name: access_token | |
|     tokenType | 1..1 | code | Bearer JSON Property Name: token_type Fixed Value: Bearer | |
|     expiresIn | 1..1 | integer | The lifetime in seconds of the access token JSON Property Name: expires_in | |
|     scope | 1..1 | string | Scopes granted by access token | |
|     subject | 1..1 | string | OAuth 2.0 client identifier of the CDS Service | |
|     patient | 0..1 | id | OAuth 2.0 client identifier of the CDS Service | |
|    context | 1..1 | CDSHookContext | Contextual data always needed for this hook type JSON: If %resource.hook = 'appointment-book'then the type is CDSHookAppointmentBookContextJSON: If %resource.hook = 'encounter-start'then the type is CDSHookEncounterStartContextJSON: If %resource.hook = 'encounter-discharge'then the type is CDSHookEncounterDischargeContextJSON: If %resource.hook = 'patient-view'then the type is CDSHookPatientViewContextJSON: If %resource.hook = 'order-dispatch'then the type is CDSHookOrderDispatchContextJSON: If %resource.hook = 'order-sign'then the type is CDSHookOrderSignContextJSON: If %resource.hook = 'order-select'then the type is CDSHookOrderSelectContext | |
|    prefetch | 0..* | Base | Additional information requested by service for this hook type JSON: Represented as a single JSON Object with named properties using the value of the key child as the key | |
|     key | 1..1 | code | Key of FHIR query | |
|     value | 1..1 | Resource | Results of query/read Id may or not be present (this is the default for elements but not resources) JSON: This object can be represented as null in the JSON structure (which counts as 'present' for cardinality purposes) | |
{
  "resourceType": "StructureDefinition",
  "id": "CDSHooksRequest",
  "text": {
    "status": "extensions",
    "div": "<!-- snip (see above) -->"
  },
  "extension": [
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm",
      "valueInteger": 1
    },
    {
      "url": "http://hl7.org/fhir/tools/StructureDefinition/json-suppress-resourcetype",
      "valueBoolean": true
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg",
      "valueCode": "fhir"
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
      "valueCode": "informative",
      "_valueCode": {
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-conformance-derivedFrom",
            "valueCanonical": "http://hl7.org/fhir/tools/ImplementationGuide/hl7.fhir.uv.tools"
          }
        ]
      }
    }
  ],
  "url": "http://hl7.org/fhir/tools/StructureDefinition/CDSHooksRequest",
  "identifier": [
    {
      "system": "urn:ietf:rfc:3986",
      "value": "urn:oid:2.16.840.1.113883.4.642.40.1.42.6"
    }
  ],
  "version": "0.8.0",
  "name": "CDSHooksRequest",
  "title": "CDSHooks Request (Logical Definition)",
  "status": "draft",
  "experimental": true,
  "date": "2025-08-05T20:48:40+00:00",
  "publisher": "HL7 International / FHIR Infrastructure",
  "contact": [
    {
      "telecom": [
        {
          "system": "url",
          "value": "http://www.hl7.org/Special/committees/fiwg"
        }
      ]
    }
  ],
  "description": "This structure is defined to allow the FHIR Validator to validate a CDSHooks Request Body. TODO: This content will be moved to the CDS Hooks specification in the future",
  "jurisdiction": [
    {
      "coding": [
        {
          "system": "http://unstats.un.org/unsd/methods/m49/m49.htm",
          "code": "001"
        }
      ]
    }
  ],
  "fhirVersion": "5.0.0",
  "mapping": [
    {
      "identity": "rim",
      "uri": "http://hl7.org/v3",
      "name": "RIM Mapping"
    }
  ],
  "kind": "logical",
  "abstract": false,
  "type": "http://hl7.org/fhir/tools/StructureDefinition/CDSHooksRequest",
  "baseDefinition": "http://hl7.org/fhir/tools/StructureDefinition/CDSHooksElement",
  "derivation": "specialization",
  "snapshot": {
    "extension": [
      {
        "url": "http://hl7.org/fhir/tools/StructureDefinition/snapshot-base-version",
        "valueString": "0.8.0"
      }
    ],
    "element": [
      {
        "id": "CDSHooksRequest",
        "path": "CDSHooksRequest",
        "short": "A request for decision support",
        "definition": "The data structure that used when invoking a CDS Hook service",
        "min": 0,
        "max": "*",
        "base": {
          "path": "Base",
          "min": 0,
          "max": "*"
        },
        "constraint": [
          {
            "key": "cds-r-1",
            "severity": "error",
            "human": "if fhirAuthorization details are provided, a fhirServer SHALL be specified",
            "expression": "fhirAuthorization.exists() implies fhirServer.exists()"
          }
        ],
        "isModifier": false,
        "mapping": [
          {
            "identity": "rim",
            "map": "n/a"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.extension",
        "path": "CDSHooksRequest.extension",
        "short": "Object that has Named Extension Properties",
        "definition": "A JSON object that has properties where the names are defined by the extension definitions",
        "comment": "Extension structures SHOULD use a strategy for naming that ensures global uniqueness, such as reverse-domain-name notation, e.g. com.cds-hooks.sandbox.myextension-practitionerspecialty. How to handle complex extensions (objects) is not defined",
        "min": 0,
        "max": "1",
        "base": {
          "path": "CDSHooksElement.extension",
          "min": 0,
          "max": "1"
        },
        "type": [
          {
            "code": "http://hl7.org/fhir/tools/StructureDefinition/CDSHooksExtensions"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.hook",
        "path": "CDSHooksRequest.hook",
        "short": "The hook that triggered this CDS Service call",
        "definition": "The hook that triggered this CDS Service call",
        "min": 1,
        "max": "1",
        "base": {
          "path": "CDSHooksRequest.hook",
          "min": 1,
          "max": "1"
        },
        "type": [
          {
            "code": "code"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.hookInstance",
        "extension": [
          {
            "url": "http://hl7.org/fhir/tools/StructureDefinition/implied-string-prefix",
            "valueString": "urn:uuid:"
          }
        ],
        "path": "CDSHooksRequest.hookInstance",
        "short": "A UUID for this particular hook call",
        "definition": "While working in the CDS Client, a user can perform multiple actions in series or in parallel. For example, a clinician might prescribe two drugs in a row; each prescription action would be assigned a unique hookInstance. This allows a CDS Service to uniquely identify each hook invocation",
        "comment": "Note: the hookInstance is globally unique and should contain enough entropy to be un-guessable.",
        "min": 1,
        "max": "1",
        "base": {
          "path": "CDSHooksRequest.hookInstance",
          "min": 1,
          "max": "1"
        },
        "type": [
          {
            "code": "uuid"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.fhirServer",
        "path": "CDSHooksRequest.fhirServer",
        "short": "The base URL of the CDS Client's FHIR server",
        "definition": "The base URL of the CDS Client's FHIR server. If fhirAuthorization is provided, this field is REQUIRED. The scheme MUST be https when production data is exchanged",
        "min": 0,
        "max": "1",
        "base": {
          "path": "CDSHooksRequest.fhirServer",
          "min": 0,
          "max": "1"
        },
        "type": [
          {
            "code": "url"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.fhirAuthorization",
        "path": "CDSHooksRequest.fhirAuthorization",
        "short": "Authorization info for service to use when querying",
        "definition": "A structure holding an OAuth 2.0 bearer access token granting the CDS Service access to FHIR resources, along with supplemental information relating to the token",
        "min": 0,
        "max": "1",
        "base": {
          "path": "CDSHooksRequest.fhirAuthorization",
          "min": 0,
          "max": "1"
        },
        "type": [
          {
            "code": "http://hl7.org/fhir/tools/StructureDefinition/CDSHooksElement"
          }
        ],
        "constraint": [
          {
            "key": "cds-r-2",
            "severity": "error",
            "human": "If the granted SMART scopes include patient scopes (i.e. 'patient/'), the patient field SHOULD be populated to identify the FHIR id of that patient.",
            "expression": "scope.contains('Patient/') implies patient.exists()"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.fhirAuthorization.extension",
        "path": "CDSHooksRequest.fhirAuthorization.extension",
        "short": "Object that has Named Extension Properties",
        "definition": "A JSON object that has properties where the names are defined by the extension definitions",
        "comment": "Extension structures SHOULD use a strategy for naming that ensures global uniqueness, such as reverse-domain-name notation, e.g. com.cds-hooks.sandbox.myextension-practitionerspecialty. How to handle complex extensions (objects) is not defined",
        "min": 0,
        "max": "1",
        "base": {
          "path": "CDSHooksElement.extension",
          "min": 0,
          "max": "1"
        },
        "type": [
          {
            "code": "http://hl7.org/fhir/tools/StructureDefinition/CDSHooksExtensions"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.fhirAuthorization.accessToken",
        "extension": [
          {
            "url": "http://hl7.org/fhir/tools/StructureDefinition/json-name",
            "valueString": "access_token"
          }
        ],
        "path": "CDSHooksRequest.fhirAuthorization.accessToken",
        "short": "OAuth 2.0 access token giving access to FHIR server",
        "definition": "This is the OAuth 2.0 access token that provides access to the FHIR server",
        "min": 1,
        "max": "1",
        "base": {
          "path": "CDSHooksRequest.fhirAuthorization.accessToken",
          "min": 1,
          "max": "1"
        },
        "type": [
          {
            "code": "string"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.fhirAuthorization.tokenType",
        "extension": [
          {
            "url": "http://hl7.org/fhir/tools/StructureDefinition/json-name",
            "valueString": "token_type"
          }
        ],
        "path": "CDSHooksRequest.fhirAuthorization.tokenType",
        "short": "Bearer",
        "definition": "The type of token provided.  (Present to support future extensibility)",
        "min": 1,
        "max": "1",
        "base": {
          "path": "CDSHooksRequest.fhirAuthorization.tokenType",
          "min": 1,
          "max": "1"
        },
        "type": [
          {
            "code": "code"
          }
        ],
        "fixedCode": "Bearer"
      },
      {
        "id": "CDSHooksRequest.fhirAuthorization.expiresIn",
        "extension": [
          {
            "url": "http://hl7.org/fhir/tools/StructureDefinition/json-name",
            "valueString": "expires_in"
          }
        ],
        "path": "CDSHooksRequest.fhirAuthorization.expiresIn",
        "short": "The lifetime in seconds of the access token",
        "definition": "The lifetime in seconds of the access token.",
        "min": 1,
        "max": "1",
        "base": {
          "path": "CDSHooksRequest.fhirAuthorization.expiresIn",
          "min": 1,
          "max": "1"
        },
        "type": [
          {
            "code": "integer"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.fhirAuthorization.scope",
        "path": "CDSHooksRequest.fhirAuthorization.scope",
        "short": "Scopes granted by access token",
        "definition": "The scopes the access token grants the CDS Service",
        "min": 1,
        "max": "1",
        "base": {
          "path": "CDSHooksRequest.fhirAuthorization.scope",
          "min": 1,
          "max": "1"
        },
        "type": [
          {
            "code": "string"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.fhirAuthorization.subject",
        "path": "CDSHooksRequest.fhirAuthorization.subject",
        "short": "OAuth 2.0 client identifier of the CDS Service",
        "definition": "The OAuth 2.0 client identifier of the CDS Service, as registered with the CDS Client's authorization server",
        "min": 1,
        "max": "1",
        "base": {
          "path": "CDSHooksRequest.fhirAuthorization.subject",
          "min": 1,
          "max": "1"
        },
        "type": [
          {
            "code": "string"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.fhirAuthorization.patient",
        "path": "CDSHooksRequest.fhirAuthorization.patient",
        "short": "OAuth 2.0 client identifier of the CDS Service",
        "definition": "The OAuth 2.0 client identifier of the CDS Service, as registered with the CDS Client's authorization server",
        "min": 0,
        "max": "1",
        "base": {
          "path": "CDSHooksRequest.fhirAuthorization.patient",
          "min": 0,
          "max": "1"
        },
        "type": [
          {
            "code": "id"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.context",
        "extension": [
          {
            "extension": [
              {
                "url": "condition",
                "valueString": "%resource.hook = 'appointment-book'"
              },
              {
                "url": "type",
                "valueCode": "http://hl7.org/fhir/tools/StructureDefinition/CDSHookAppointmentBookContext"
              }
            ],
            "url": "http://hl7.org/fhir/tools/StructureDefinition/type-specifier"
          },
          {
            "extension": [
              {
                "url": "condition",
                "valueString": "%resource.hook = 'encounter-start'"
              },
              {
                "url": "type",
                "valueCode": "http://hl7.org/fhir/tools/StructureDefinition/CDSHookEncounterStartContext"
              }
            ],
            "url": "http://hl7.org/fhir/tools/StructureDefinition/type-specifier"
          },
          {
            "extension": [
              {
                "url": "condition",
                "valueString": "%resource.hook = 'encounter-discharge'"
              },
              {
                "url": "type",
                "valueCode": "http://hl7.org/fhir/tools/StructureDefinition/CDSHookEncounterDischargeContext"
              }
            ],
            "url": "http://hl7.org/fhir/tools/StructureDefinition/type-specifier"
          },
          {
            "extension": [
              {
                "url": "condition",
                "valueString": "%resource.hook = 'patient-view'"
              },
              {
                "url": "type",
                "valueCode": "http://hl7.org/fhir/tools/StructureDefinition/CDSHookPatientViewContext"
              }
            ],
            "url": "http://hl7.org/fhir/tools/StructureDefinition/type-specifier"
          },
          {
            "extension": [
              {
                "url": "condition",
                "valueString": "%resource.hook = 'order-dispatch'"
              },
              {
                "url": "type",
                "valueCode": "http://hl7.org/fhir/tools/StructureDefinition/CDSHookOrderDispatchContext"
              }
            ],
            "url": "http://hl7.org/fhir/tools/StructureDefinition/type-specifier"
          },
          {
            "extension": [
              {
                "url": "condition",
                "valueString": "%resource.hook = 'order-sign'"
              },
              {
                "url": "type",
                "valueCode": "http://hl7.org/fhir/tools/StructureDefinition/CDSHookOrderSignContext"
              }
            ],
            "url": "http://hl7.org/fhir/tools/StructureDefinition/type-specifier"
          },
          {
            "extension": [
              {
                "url": "condition",
                "valueString": "%resource.hook = 'order-select'"
              },
              {
                "url": "type",
                "valueCode": "http://hl7.org/fhir/tools/StructureDefinition/CDSHookOrderSelectContext"
              }
            ],
            "url": "http://hl7.org/fhir/tools/StructureDefinition/type-specifier"
          }
        ],
        "path": "CDSHooksRequest.context",
        "short": "Contextual data always needed for this hook type",
        "definition": "Hook-specific contextual data that the CDS service will need",
        "min": 1,
        "max": "1",
        "base": {
          "path": "CDSHooksRequest.context",
          "min": 1,
          "max": "1"
        },
        "type": [
          {
            "code": "http://hl7.org/fhir/tools/StructureDefinition/CDSHookContext"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.prefetch",
        "extension": [
          {
            "url": "http://hl7.org/fhir/tools/StructureDefinition/json-property-key",
            "valueCode": "key"
          }
        ],
        "path": "CDSHooksRequest.prefetch",
        "short": "Additional information requested by service for this hook type",
        "definition": "An object containing key/value pairs of FHIR queries that this Request is requesting the CDS Client to perform and provide on each Request call. The key is a string that describes the type of data being requested and the value is a string representing the FHIR query",
        "min": 0,
        "max": "*",
        "base": {
          "path": "CDSHooksRequest.prefetch",
          "min": 0,
          "max": "*"
        },
        "type": [
          {
            "code": "Base"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.prefetch.key",
        "path": "CDSHooksRequest.prefetch.key",
        "short": "Key of FHIR query",
        "definition": "Name of the FHIR query/read from the CDS Hooks Services object provided by the server",
        "min": 1,
        "max": "1",
        "base": {
          "path": "CDSHooksRequest.prefetch.key",
          "min": 1,
          "max": "1"
        },
        "type": [
          {
            "code": "code"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.prefetch.value",
        "extension": [
          {
            "url": "http://hl7.org/fhir/tools/StructureDefinition/json-nullable",
            "valueBoolean": true
          },
          {
            "url": "http://hl7.org/fhir/tools/StructureDefinition/id-expectation",
            "valueCode": "optional"
          }
        ],
        "path": "CDSHooksRequest.prefetch.value",
        "short": "Results of query/read",
        "definition": "What was found by executing the search or read requested by the CDS Hooks Service in the context of this particular hook invocation",
        "min": 1,
        "max": "1",
        "base": {
          "path": "CDSHooksRequest.prefetch.value",
          "min": 1,
          "max": "1"
        },
        "type": [
          {
            "code": "Resource"
          }
        ]
      }
    ]
  },
  "differential": {
    "element": [
      {
        "id": "CDSHooksRequest",
        "path": "CDSHooksRequest",
        "short": "A request for decision support",
        "definition": "The data structure that used when invoking a CDS Hook service",
        "constraint": [
          {
            "key": "cds-r-1",
            "severity": "error",
            "human": "if fhirAuthorization details are provided, a fhirServer SHALL be specified",
            "expression": "fhirAuthorization.exists() implies fhirServer.exists()"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.hook",
        "path": "CDSHooksRequest.hook",
        "short": "The hook that triggered this CDS Service call",
        "definition": "The hook that triggered this CDS Service call",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "code"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.hookInstance",
        "extension": [
          {
            "url": "http://hl7.org/fhir/tools/StructureDefinition/implied-string-prefix",
            "valueString": "urn:uuid:"
          }
        ],
        "path": "CDSHooksRequest.hookInstance",
        "short": "A UUID for this particular hook call",
        "definition": "While working in the CDS Client, a user can perform multiple actions in series or in parallel. For example, a clinician might prescribe two drugs in a row; each prescription action would be assigned a unique hookInstance. This allows a CDS Service to uniquely identify each hook invocation",
        "comment": "Note: the hookInstance is globally unique and should contain enough entropy to be un-guessable.",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "uuid"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.fhirServer",
        "path": "CDSHooksRequest.fhirServer",
        "short": "The base URL of the CDS Client's FHIR server",
        "definition": "The base URL of the CDS Client's FHIR server. If fhirAuthorization is provided, this field is REQUIRED. The scheme MUST be https when production data is exchanged",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "url"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.fhirAuthorization",
        "path": "CDSHooksRequest.fhirAuthorization",
        "short": "Authorization info for service to use when querying",
        "definition": "A structure holding an OAuth 2.0 bearer access token granting the CDS Service access to FHIR resources, along with supplemental information relating to the token",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "http://hl7.org/fhir/tools/StructureDefinition/CDSHooksElement"
          }
        ],
        "constraint": [
          {
            "key": "cds-r-2",
            "severity": "error",
            "human": "If the granted SMART scopes include patient scopes (i.e. 'patient/'), the patient field SHOULD be populated to identify the FHIR id of that patient.",
            "expression": "scope.contains('Patient/') implies patient.exists()"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.fhirAuthorization.accessToken",
        "extension": [
          {
            "url": "http://hl7.org/fhir/tools/StructureDefinition/json-name",
            "valueString": "access_token"
          }
        ],
        "path": "CDSHooksRequest.fhirAuthorization.accessToken",
        "short": "OAuth 2.0 access token giving access to FHIR server",
        "definition": "This is the OAuth 2.0 access token that provides access to the FHIR server",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "string"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.fhirAuthorization.tokenType",
        "extension": [
          {
            "url": "http://hl7.org/fhir/tools/StructureDefinition/json-name",
            "valueString": "token_type"
          }
        ],
        "path": "CDSHooksRequest.fhirAuthorization.tokenType",
        "short": "Bearer",
        "definition": "The type of token provided.  (Present to support future extensibility)",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "code"
          }
        ],
        "fixedCode": "Bearer"
      },
      {
        "id": "CDSHooksRequest.fhirAuthorization.expiresIn",
        "extension": [
          {
            "url": "http://hl7.org/fhir/tools/StructureDefinition/json-name",
            "valueString": "expires_in"
          }
        ],
        "path": "CDSHooksRequest.fhirAuthorization.expiresIn",
        "short": "The lifetime in seconds of the access token",
        "definition": "The lifetime in seconds of the access token.",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "integer"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.fhirAuthorization.scope",
        "path": "CDSHooksRequest.fhirAuthorization.scope",
        "short": "Scopes granted by access token",
        "definition": "The scopes the access token grants the CDS Service",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "string"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.fhirAuthorization.subject",
        "path": "CDSHooksRequest.fhirAuthorization.subject",
        "short": "OAuth 2.0 client identifier of the CDS Service",
        "definition": "The OAuth 2.0 client identifier of the CDS Service, as registered with the CDS Client's authorization server",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "string"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.fhirAuthorization.patient",
        "path": "CDSHooksRequest.fhirAuthorization.patient",
        "short": "OAuth 2.0 client identifier of the CDS Service",
        "definition": "The OAuth 2.0 client identifier of the CDS Service, as registered with the CDS Client's authorization server",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "id"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.context",
        "extension": [
          {
            "extension": [
              {
                "url": "condition",
                "valueString": "%resource.hook = 'appointment-book'"
              },
              {
                "url": "type",
                "valueCode": "http://hl7.org/fhir/tools/StructureDefinition/CDSHookAppointmentBookContext"
              }
            ],
            "url": "http://hl7.org/fhir/tools/StructureDefinition/type-specifier"
          },
          {
            "extension": [
              {
                "url": "condition",
                "valueString": "%resource.hook = 'encounter-start'"
              },
              {
                "url": "type",
                "valueCode": "http://hl7.org/fhir/tools/StructureDefinition/CDSHookEncounterStartContext"
              }
            ],
            "url": "http://hl7.org/fhir/tools/StructureDefinition/type-specifier"
          },
          {
            "extension": [
              {
                "url": "condition",
                "valueString": "%resource.hook = 'encounter-discharge'"
              },
              {
                "url": "type",
                "valueCode": "http://hl7.org/fhir/tools/StructureDefinition/CDSHookEncounterDischargeContext"
              }
            ],
            "url": "http://hl7.org/fhir/tools/StructureDefinition/type-specifier"
          },
          {
            "extension": [
              {
                "url": "condition",
                "valueString": "%resource.hook = 'patient-view'"
              },
              {
                "url": "type",
                "valueCode": "http://hl7.org/fhir/tools/StructureDefinition/CDSHookPatientViewContext"
              }
            ],
            "url": "http://hl7.org/fhir/tools/StructureDefinition/type-specifier"
          },
          {
            "extension": [
              {
                "url": "condition",
                "valueString": "%resource.hook = 'order-dispatch'"
              },
              {
                "url": "type",
                "valueCode": "http://hl7.org/fhir/tools/StructureDefinition/CDSHookOrderDispatchContext"
              }
            ],
            "url": "http://hl7.org/fhir/tools/StructureDefinition/type-specifier"
          },
          {
            "extension": [
              {
                "url": "condition",
                "valueString": "%resource.hook = 'order-sign'"
              },
              {
                "url": "type",
                "valueCode": "http://hl7.org/fhir/tools/StructureDefinition/CDSHookOrderSignContext"
              }
            ],
            "url": "http://hl7.org/fhir/tools/StructureDefinition/type-specifier"
          },
          {
            "extension": [
              {
                "url": "condition",
                "valueString": "%resource.hook = 'order-select'"
              },
              {
                "url": "type",
                "valueCode": "http://hl7.org/fhir/tools/StructureDefinition/CDSHookOrderSelectContext"
              }
            ],
            "url": "http://hl7.org/fhir/tools/StructureDefinition/type-specifier"
          }
        ],
        "path": "CDSHooksRequest.context",
        "short": "Contextual data always needed for this hook type",
        "definition": "Hook-specific contextual data that the CDS service will need",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "http://hl7.org/fhir/tools/StructureDefinition/CDSHookContext"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.prefetch",
        "extension": [
          {
            "url": "http://hl7.org/fhir/tools/StructureDefinition/json-property-key",
            "valueCode": "key"
          }
        ],
        "path": "CDSHooksRequest.prefetch",
        "short": "Additional information requested by service for this hook type",
        "definition": "An object containing key/value pairs of FHIR queries that this Request is requesting the CDS Client to perform and provide on each Request call. The key is a string that describes the type of data being requested and the value is a string representing the FHIR query",
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "Base"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.prefetch.key",
        "path": "CDSHooksRequest.prefetch.key",
        "short": "Key of FHIR query",
        "definition": "Name of the FHIR query/read from the CDS Hooks Services object provided by the server",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "code"
          }
        ]
      },
      {
        "id": "CDSHooksRequest.prefetch.value",
        "extension": [
          {
            "url": "http://hl7.org/fhir/tools/StructureDefinition/json-nullable",
            "valueBoolean": true
          },
          {
            "url": "http://hl7.org/fhir/tools/StructureDefinition/id-expectation",
            "valueCode": "optional"
          }
        ],
        "path": "CDSHooksRequest.prefetch.value",
        "short": "Results of query/read",
        "definition": "What was found by executing the search or read requested by the CDS Hooks Service in the context of this particular hook invocation",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Resource"
          }
        ]
      }
    ]
  }
}